package vista;

import java.awt.Dimension;
import java.awt.Graphics;

import javax.swing.ImageIcon;


public class Fondo extends javax.swing.JPanel {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	ImageIcon imagen; 
	public Fondo(String nombre) {
		super();
		initGUI();
		imagen = new ImageIcon(getClass().getResource(nombre));
		setSize(imagen.getIconWidth(),imagen.getIconHeight());
	}
	
	
	protected void paintComponent (Graphics g){
		Dimension d = getSize();
		g.drawImage(imagen.getImage(),0,0,d.width,d.height,null);
		this.setOpaque(false);
		super.paintComponents(g);
	} 
	
	
	private void initGUI() {
		try {
			setPreferredSize(new Dimension(400, 300));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	

}
